/**
 * Created by user on 2018/4/16.
 */
import { LoginActions } from '../actions'

const { LoginType } = LoginActions

const login_state = {
  loading: false,
  auth: true
}

const LoginState = (state = login_state, action) => {
  switch (action.type) {
    case LoginType.toggle_login_loading:
      return Object.assign({}, state, {
        loading: action.loading
      })
    case LoginType.toggle_auth:
      return Object.assign({}, state, {
        auth: action.auth
      })
    default:
      return state
  }
}

export default LoginState
